<template>
    <!-- 汇总单查询 -->
    <div class="container">
        <!-- 表单栏 -->
        <el-row class="form-container">
            <el-col :span="24">
                <avue-form ref="form" v-model="listForm.data" :option="listForm.option" class="yz-form"></avue-form>
                <button class="check-btn right-btn" @click="check"><img src="../../assets/imgs/operation_btn_icon_chaxun_default.png" alt="" class="btn-img">查询</button>
            </el-col>
        </el-row>
        <!-- 表格栏 -->
        <avue-crud :data="listTable.data" :option="listTable.option" @current-change="listPage" :page="listTable.page"></avue-crud>
    </div>
</template>

<script>
const DIC={
    seller:[]
}
export default {
  data: function() {
    return {
        listForm:{
            data:{},
            option:{
                dicData:DIC,
                column:[
                    {
                        label:"售票日期起",
                        prop:"sellDate",
                        type:"datetimerange",
                        span:8
                    },
                    {
                        label:"汇总单号",
                        prop:"totalNum",
                        span:5
                    },
                    {
                        label:"售票员",
                        prop:"seller",
                        type:"select",
                        dicData:"seller",
                        span:5
                    },
                ]
            }
        },
        listTable:{
            page: {
                pageSizes: [10],
                total: 20,
                currentPage: 1,
                pageSize: 10,
            },
            data:[],
            option:{
                menu:false,
                page:true,
                column:[
                    {
                        label:"使用票据合计",
                        prop:"ticket_bill_cost_count"
                    },
                    {
                        label:"票据用量(车票)",
                        prop:"ticket_bill_cost_count"
                    },
                    {
                        label:"票据用量(免票儿童)",
                        prop:"enfant_bill_cost_count"
                    },
                    {
                        label:"票据用量(退票凭证)",
                        prop:"refund_bill_cost_count"
                    },
                    {
                        label:"票据起始号",
                        prop:"begin_no"
                    },
                    {
                        label:"票据结束号",
                        prop:"end_no"
                    },
                    {
                        label:"打印次数",
                        prop:"print_count"
                    },
                    {
                        label:"最后打印用户",
                        prop:"last_print_oper"
                    },
                    {
                        label:"取票数",
                        prop:"ticket_bill_cost_count"
                    },
                    {
                        label:"取订票数",
                        prop:"book_count"
                    },
                    {
                        label:"订票金额",
                        prop:"book_sum"
                    },
                    {
                        label:"退票数",
                        prop:"refund_count"
                    },
                    {
                        label:"退还金额",
                        prop:"insurance_refund_sum"
                    },
                    {
                        label:"退还金额(非现金)",
                        prop:"refund_sum_noncash"
                    },
                    {
                        label:"退票手续费",
                        prop:"refund_poundage"
                    },
                    {
                        label:"废票数",
                        prop:"del_count"
                    },
                    {
                        label:"废票金额",
                        prop:"del_sum"
                    },
                    {
                        label:"废票金额(非现金)",
                        prop:"del_sum_noncash"
                    },
                    {
                        label:"售票应缴金额",
                        prop:"paysum"
                    },
                    {
                        label:"首保险应缴金额",
                        prop:"insurance_sum"
                    },
                    {
                        label:"已缴",
                        prop:"is_payed"
                    },
                    {
                        label:"汇总单号",
                        prop:"salesumno"
                    },
                    {
                        label:"售票员",
                        prop:"seller_no"
                    },
                    {
                        label:"售票数",
                        prop:"sale_count"
                    },
                    {
                        label:"售票金额",
                        prop:"sale_sum"
                    },
                    {
                        label:"售票金额(非现金)",
                        prop:"sale_sum_noncash"
                    },
                    {
                        label:"售外站票数",
                        prop:"sale_remote_count"
                    },
                    {
                        label:"售外站票金额",
                        prop:"sale_remote_sum"
                    },
                    {
                        label:"售保险数",
                        prop:"insurance_count"
                    },
                    {
                        label:"售保险金额",
                        prop:"insurance_sum"
                    },
                    {
                        label:"售保险金额(非现金)",
                        prop:"insurance_noncash"
                    },
                    {
                        label:"取票数",
                        prop:"sale_count"
                    },
                ]
            }
        }
    };
  },
  methods: {
      getseller(){
          this.postRequest("/sys/user/listWithSpell").then(data=>{
              for(var item of data.data){
                  DIC.seller.push({
                      label:item.name,
                      value:item.id
                  });
              }
          })
      },
      check(){
          this.postRequest("/query/salesum/detail/list",{
              filterRules:JSON.stringify([
                  {"field":"sum.create_time","op":"dge","value":this.dateToString(this.listForm.data.sellDate[0])},{"field":"sum.create_time","op":"dle","value":this.dateToString(this.listForm.data.sellDate[1])},{"field":"sum.salesumno","op":"eq","value":this.listForm.data.totalNum},{"field":"sum.seller_id","op":"eq","value":this.listForm.data.seller}
              ])
          }).then(data=>{
              this.listTable.data=data.data.list;
          })
      },
      listPage(val){
          this.listTable.page.currentPage=val;
          this.getListTable();
      },
      getListTable(){
          this.postRequest("/query/salesum/detail/list",{
              rows:10,
              page:this.listTable.page.currentPage
          }).then(data=>{
              this.listTable.page.total=data.data.totalRow;
              this.listTable.data=data.data.list;
          })
      }
  },
  computed: {},
  watch: {},
  mounted() {
      console.log("汇总单查询");
      this.$emit("sendActive", "4-3");
      this.getListTable();
      this.getseller();
  }
};
</script>
<style scoped src="../../assets/css/financeManage/listCheck.css">
</style>